package ipgather.core.proxy.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.Test;

import com.alibaba.fastjson.JSON;

import ipgather.core.redis.RedisDbAdapter;
import ipgather.entity.Host;
import redis.clients.jedis.Jedis;

public class HostProductor extends Thread{
	
	private SyncStackHost stackHost;
	public HostProductor(SyncStackHost stackHost) {
		this.stackHost = stackHost;
	}

	@Override
	public void run() {
		/*Jedis jedis = RedisDbAdapter.getJedis();
		Set<String> keys = jedis.keys("*");
		List<String> listKeys = new ArrayList<>(keys);
		int size = keys.size();
		
		int cOffset = 0;
		List<Host> hosts = null;
		Host host = null;
		while(true){
			hosts = new ArrayList<>();
			for(int i =cOffset;i<=Math.min(cOffset+20, size);i++){
				host = JSON.parseObject(jedis.get(listKeys.get(i)),Host.class);
				stackHost.push(host);;
			}
			cOffset+=20;
		}*/
		
		
	}
	
	public static void main(String[] args) {
		SyncStackHost stackHost = new SyncStackHost();
		HostProductor productor = new HostProductor(stackHost);
		productor.start();
		try {
			productor.join();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
